<?php

/**
 * Demande form base class.
 *
 * @package    form
 * @subpackage demande
 * @version    SVN: $Id: sfPropelFormGeneratedTemplate.php 8807 2008-05-06 14:12:28Z fabien $
 */
class BaseDemandeForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'demande_id'           => new sfWidgetFormInputHidden(),
      'date'                 => new sfWidgetFormDateTime(),
      'nom'                  => new sfWidgetFormInput(),
      'prenom'               => new sfWidgetFormInput(),
      'statut_id'            => new sfWidgetFormPropelSelect(array('model' => 'TypeStatut', 'add_empty' => true)),
      'statut_autre'         => new sfWidgetFormInput(),
      'etablissement_id'     => new sfWidgetFormPropelSelect(array('model' => 'Etablissement', 'add_empty' => true)),
      'structure_autre'      => new sfWidgetFormInput(),
      'intitule_etude'       => new sfWidgetFormInput(),
      'type_donnees_id'      => new sfWidgetFormPropelSelect(array('model' => 'TypeDonnees', 'add_empty' => true)),
      'type_donnees_autre'   => new sfWidgetFormInput(),
      'periode_debut'        => new sfWidgetFormDate(),
      'periode_fin'          => new sfWidgetFormDate(),
      'format_donnees_id'    => new sfWidgetFormPropelSelect(array('model' => 'TypeFormatDonnees', 'add_empty' => true)),
      'is_besoin_assistance' => new sfWidgetFormInputCheckbox(),
      'type_motivation_id'   => new sfWidgetFormPropelSelect(array('model' => 'TypeMotivation', 'add_empty' => true)),
      'commentaire'          => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'demande_id'           => new sfValidatorPropelChoice(array('model' => 'Demande', 'column' => 'demande_id', 'required' => false)),
      'date'                 => new sfValidatorDateTime(array('required' => false)),
      'nom'                  => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'prenom'               => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'statut_id'            => new sfValidatorPropelChoice(array('model' => 'TypeStatut', 'column' => 'idstatut', 'required' => false)),
      'statut_autre'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'etablissement_id'     => new sfValidatorPropelChoice(array('model' => 'Etablissement', 'column' => 'idetablissement', 'required' => false)),
      'structure_autre'      => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'intitule_etude'       => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'type_donnees_id'      => new sfValidatorPropelChoice(array('model' => 'TypeDonnees', 'column' => 'idtype_donnee', 'required' => false)),
      'type_donnees_autre'   => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'periode_debut'        => new sfValidatorDate(array('required' => false)),
      'periode_fin'          => new sfValidatorDate(array('required' => false)),
      'format_donnees_id'    => new sfValidatorPropelChoice(array('model' => 'TypeFormatDonnees', 'column' => 'idformat_donnees', 'required' => false)),
      'is_besoin_assistance' => new sfValidatorBoolean(array('required' => false)),
      'type_motivation_id'   => new sfValidatorPropelChoice(array('model' => 'TypeMotivation', 'column' => 'idtype_motivation', 'required' => false)),
      'commentaire'          => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('demande[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Demande';
  }


}
